 var id = getvl("id");
$(function(){
	     if(id!=''){
	     	     huifu();
	     }else{
	     	alert("未传入有效值");
	     }
});
   
   
   
 function huifu(){
		$.ajax({                   
	   url: urlcore + "/api/comment/selectByIdcommernt?id="+id,
		type: "get",
		dataType: 'json',
		contentType: "application/json;charset=utf-8",
		success:function(data){
			if (data.success == true) { 
				var da=data.data;
	var pingjiaguanli='<div class="sell_pingjia_xinxi">'+
'		<div class="sell_pingjia_tu">'+
'			<img onerror="errorImg(this)" src="'+da.user.headImg+'" />'+
'		</div>'+
'		<div class="sell_pingjia_wenzi">'+
'			<div class="sell_pingjia_mz clearfix">'+
'				<h5>'+da.user.userName+'</h5>'+
'				<div class="fr">';
                      for(var i=0;i<da.serviceLevel;i++){
               pingjiaguanli+='<img src="../images/star.png" />';
                      }
var gmtDatetime = new Date(da.gmtDatetime).pattern("yyyy-MM-dd hh:mm:ss"); 
/*'					<i>4.0分</i>'+*/
 pingjiaguanli+'</div>'+
'			</div>'+
'			<span>'+gmtDatetime+'</span>'+
'			<p>'+da.commentContent+'</p>';
                 if(da.commentImg!=null){
         	pingjiaguanli+='<div class="sell_pingjia_img clearfix">';
         	             var imgarr1 = da.commentImg.split("***");
         	             $.each(imgarr1, function(index, value) {
 pingjiaguanli +='<img onerror="errorImg(this)" src="'+value+'" data-preview-src="" data-preview-group="1" />';
						});
 pingjiaguanli+='</div>';
                  }
'		</div>'+
'	</div>';
             $("#pingjiaguanli").append(pingjiaguanli);
			}
		},
		error:function() {
			alert("error");
		}
	});
 }

function tijiao(){
	var huifu=$("#huifu").val();
	 if(huifu.length<500){
		
      $.ajax({  
        url : urlcore + "/api/replymessage/add",
        type : "post",  
        contentType: "application/json;charset=utf-8",
        data : JSON.stringify({
        	reviewcontent:huifu,
        	commentid:id,
        }),
        	dataType: "json",
        success: function(data) {//data是返回的hash,key之类的值，key是定义的文件名 
        	window.location.href = document.referrer
        },
        error:function(){  
            alert("修改失败");  
        }  
    });     			
			}else{
			alert("文本超出");
			}
 }
